package cn.hnbjx.prepaid.dao;

import cn.hnbjx.prepaid.pojo.News;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NewsDao {
    @Insert("insert into news (name,type,content,createTime) values (#{name},#{type},#{content},now())")
    void insert(News news);
    @Select("select * from `news` where `id`=#{id}")
    News findNews(Integer id);
    @Select("select * from `news` where name like concat('%',#{key},'%') order by id desc")
    List<News> allNews(String key);
    @Select("select * from `news` where type=#{type} order by id desc")
    List<News> apiallNews(Integer type);
    @Update("update `news` set name=#{name},type=#{type},content=#{content} where id=#{id}")
    int updateNews(News news);
    @Delete("delete from `news` where id = #{id}")
    int delete(Integer id);
}
